package com.dp.vo;

import java.io.Serializable;

import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;


@Entity
@Table(name = "t_channel_ebook")
//@NamedQueries({@NamedQuery(name = "TChannelEbook.findAll", query = "SELECT t FROM TChannelEbook t"), @NamedQuery(name = "TChannelEbook.findByContentid", query = "SELECT t FROM TChannelEbook t WHERE t.tebookContent = :contentid")})
public class TChannelEbook  implements Serializable{
	private static final long serialVersionUID = 1L;
	@EmbeddedId
    protected ChannelEbookPK channelEbookPK;                 //频道id
	@JoinColumn(name = "channel", referencedColumnName = "channleid",insertable = false, updatable = false)
	@ManyToOne
	private NewsExtendsChannel newsExtendsChannel;
	
	@JoinColumn(name = "contentid", referencedColumnName = "contentid",insertable = false, updatable = false)   
	@ManyToOne
    private TEbookContent tebookContent;     //ebook内容
	
	public TChannelEbook(){
	}
	
	public TChannelEbook(ChannelEbookPK channelEbookPK) {
        this.channelEbookPK = channelEbookPK;
    }

    public TChannelEbook(Integer contentid, Integer channel) {
        this.channelEbookPK = new ChannelEbookPK(contentid, channel);
    }
    
	public ChannelEbookPK getChannelEbookPK() {
		return channelEbookPK;
	}

	public void setChannelEbookPK(ChannelEbookPK channelEbookPK) {
		this.channelEbookPK = channelEbookPK;
	}

	public NewsExtendsChannel getNewsExtendsChannel() {
		return newsExtendsChannel;
	}
	public void setNewsExtendsChannel(NewsExtendsChannel newsExtendsChannel) {
		this.newsExtendsChannel = newsExtendsChannel;
	}
	public TEbookContent getTebookContent() {
		return tebookContent;
	}
	public void setTebookContent(TEbookContent tebookContent) {
		this.tebookContent = tebookContent;
	}
	
	@Override
	public int hashCode() {
	        int hash = 0;
	        hash += (channelEbookPK != null ? channelEbookPK.hashCode() : 0);
	        return hash;
	}

    @Override
	public boolean equals(Object object) {
	    if (!(object instanceof TChannelEbook)) {
	          return false;
	     }
	    TChannelEbook other = (TChannelEbook) object;
	     if ((this.channelEbookPK == null && other.channelEbookPK != null) || (this.channelEbookPK != null && !this.channelEbookPK.equals(other.channelEbookPK))) {
	         return false;
	     }
	     return true;
	}
	    
	@Override
    public String toString() {
        return "com.dp.vo.TChannelEbook[channelEbookPK=" + channelEbookPK + "]";
    }
	
	
}
